package org.hugh.space.dao.impl;

import java.util.List;

import org.hugh.space.dao.UserDao;
import org.hugh.space.entity.UserEntity;
import org.hugh.space.entity.UserRole;

public class UserDaoImpl extends BaseDaoImpl<Long, UserEntity> implements
		UserDao {

	public UserDaoImpl() {
		super(UserEntity.class);
	}
	
	public UserEntity getByEmail(final String email) {
		String query = "select from " + UserEntity.class.getName()
				+ " where email == pEmail parameters String pEmail";
		return selectOne(query, params(email));
	}

	public List<UserEntity> getByRole(final UserRole role) {
		String query = "select from " + UserEntity.class.getName()
				+ " where role == pRole"
				+ " parameters org.hugh.space.entity.UserRole pRole";
		return select(query, params(role));
	}
}
